package cn.com.surker.production.service.impl;

import cn.com.surker.enums.StateEnum;
import cn.com.surker.production.dao.IndentPumpDao;
import cn.com.surker.production.entity.ProductionIndentPump;
import cn.com.surker.production.service.ErpIndentPumpService;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 生产计划表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2024-07-25
 */
@Service
public class ErpIndentPumpServiceImpl extends IndentPumpServiceBaseImpl implements ErpIndentPumpService {

	@Override
	public int deletePumps(List<Long> ids) {
		if (ids == null || ids.isEmpty()) {
			return -1;
		}
		UpdateWrapper<ProductionIndentPump> uw = new UpdateWrapper<>();
		uw.in("id", ids);
		uw.set("status", StateEnum.DISABLED.getCode());
		int update = indentPumpDao.update(null, uw);
		return update;
	}

	@Override
	public int delByIndentId(Long indentId) {
		if (indentId == null) {
			return -1;
		}
		UpdateWrapper<ProductionIndentPump> uw = new UpdateWrapper<>();
		uw.eq("indent_id", indentId);
		uw.set("status", StateEnum.DISABLED.getCode());
		int update = indentPumpDao.update(null, uw);
		return update;

	}
}